package com.bjsxt;
//泛型的态方法
public class Test3 {
    public static void main(String[] args) {
        /*非静态方法*/
        //正常创建对象
        MethodGeneric methodGeneric = new MethodGeneric();
        //调用方法时不用声明泛型类型，编译器会自动判断出
        methodGeneric.setName(23476);
        methodGeneric.setName("good");
        //有返回值
        MethodGeneric methodGeneric1 = new MethodGeneric();
        String name = methodGeneric1.getName("bjsxt");
        System.out.println(name);
        Integer name1 = methodGeneric1.getName(987223);
        System.out.println(name1);

       /*静态方法*/
       MethodGeneric.getFlag("love");
       MethodGeneric.getFlag(213);
       //有返回值
       Integer flag1 = MethodGeneric.setFlag(3223);
       String flag2 = MethodGeneric.setFlag("sky");
        System.out.println(flag1);
        System.out.println(flag2);

        //可变参数
        MethodGeneric methodGeneric2 = new MethodGeneric();
        String[] arr = new String[]{"a","b","c"};//定义与初始化数组
        methodGeneric2.method(arr);
        Integer[] arr2 = new Integer[]{1,2,3};
        methodGeneric2.method(arr2);
        System.out.println(arr2);
    }
}
